package com.baohua.service;

import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.baohua.exception.BaohuaSystemException;
import com.baohua.model.Dictionary;
import com.baohua.model.DiningTable;
import com.baohua.model.Goods;
import com.baohua.model.OrderDetails;

public interface OrderService {

	/**
	 * 获取所有的餐桌
	 * @param hasBeanSelectedTable 已经被选中的餐桌
	 */
	public JSONArray getAllDiningTable(String hasBeanSelectedTable);
	
	/**
	 * 修改订单
	 * @param modifyMsg
	 * @return isSuccess
	 */
	public boolean modifyOrder(String modifyMsg);
	
	/**
	 * 找出所以商品
	 * @return
	 */
	public List<Goods> findAllGoods();
	
	/**
	 * 废弃订单
	 * @param orderHeaderId
	 * @return success
	 */
	public boolean updateOrder(long orderHeaderId);
	
	/**
	 * 根据条件获取订单明细信息
	 * @param orderHeader
	 * @return
	 */
	public List<OrderDetails> findOrderDetailsByOrderHeaderId(String orderHeader);
	
	/**
	 * 根据父code拿到子列表
	 * @param categoryCodes
	 * @return 字典列表
	 */
	public List<Dictionary> findDictionaryByParentCode(String... categoryCodes);
	
	/**
	 * 传进来任意个数任意节点的code，查询相应的dictionary信息
	 * Dictionary<red>s</red>
	 */
	public List<Dictionary> findDictionarysByCode(String... categoryCodes);
	
	/**
	 * 根据种类父Id找其儿子
	 * @param dictionaryPIDs
	 * @return
	 */
	public Map<Long, String> findDictionaryByPIdAndCode(String... categoryCodes);
	
	/**
	 * 订单头信息记录数
	 * @return
	 */
	public long queryCountOrderHeader(String searchCondition) throws UnsupportedEncodingException;
	/**
	 * 查询所以订单信息
	 * @return
	 */
	public JSONArray findListOrderHeader(String searchCondition, int startPost, int pageSize) throws UnsupportedEncodingException;
	
	/**
	 * 添加订单
	 * @param orderString
	 * @return 添加成功返回true
	 * @throws BaohuaSystemException
	 * @throws ParseException
	 */
	public boolean addOrder(String orderString) throws BaohuaSystemException, ParseException;
	
	/**
	 * 获得餐桌列表By种类Id
	 * @param categoryId 种类Id
	 * @return 餐桌列表
	 */
	public List<DiningTable> findDiningTableByCategoryId(long categoryId);
	
	/**
	 * 获取指定种类代码的种类
	 * @return 返回种类
	 * @param menuCode 菜单代码
	 */
	public List<Dictionary> findCategoryByCode(String menuCode); 
	
	/**
	 * 给定种类Id获取该类菜单的所以菜
	 * @param categoryId 菜的种类
	 * @return 该类的所以菜
	 */
	public List<Goods> findDishByGoodsCategory(long categoryId);
	
}
